<html>
<head>
    <meta name="layout" content="freshmade">
</head>

<body>

<div id="content-wrapper">
    <div class="center-wrapper">
        <div class="content">
            <div id="main">
                <div class="post">
                    <div class="post-title">
                        <h1>Role List</h1>
                        <g:render template="/template/messageBar"/>
                    </div>

                    <div class="post-date">
                        <g:render template="/template/listBar1" model="[size: roles.size()]"/>
                        | <g:link action="review">Review...</g:link>
                    </div>
                </div>
                <table class="data-table">
                    <tr>
                        <th>Role Name</th>
                        <th>Permissions</th>
                        <th>Users</th>
                    </tr>
                    <tbody>
                    <g:each in="${roles}" status="i" var="role">
                        <tr class="${(i % 2) == 0 ? 'even' : 'odd'}">
                            <td><g:link action="edit" id="${role.id}">${role.name}</g:link></td>
                            <td>
                                <g:each in="${role.permissions}" status="j" var="permission">
                                    <g:if test="${j != 0}">|</g:if> ${permission}
                                </g:each>
                            </td>
                            <td>
                                <g:each in="${role.users}" status="k" var="user">
                                    <g:if test="${k != 0}">|</g:if>  ${user.name}
                                </g:each>
                            </td>
                        </tr>
                    </g:each>
                    </tbody>
                </table>
            </div>

            <div class="clearer">&nbsp;</div>
        </div>

    </div>
</div>

</body>
</html>